package com.bawei.yangzongcai___day2.MaiDongFangQi.day2;

import com.bawei.mvp.Model.BoosModel;

import java.util.List;

import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

/**
 * create by ertu
 * create on 2021/7/30
 * description
 */
public class AoodModel  extends BoosModel implements AoodContrect.aoodmodel {

    @Override
    public void getmoodel(final Aoodcallback aoodcallback) {
        Okhttpappture.getOkhttpappture().retrofits("https://gank.io/api/v2/data/category/Girl/type/Girl/")
              .create(api.class)
                .getapi()
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.computation())
                .subscribe(new Observer<JavaDuoyidian>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(JavaDuoyidian javaDuoyidian) {
                        List<JavaDuoyidian.DataBean> dataBeans = javaDuoyidian.getData();
                        aoodcallback.sueess(dataBeans);
                    }

                    @Override
                    public void onError(Throwable e) {
                        aoodcallback.fiad();
                    }

                    @Override
                    public void onComplete() {

                    }
                });


    }
}
